#define  _CRT_SECURE_NO_WARNINGS



#include<stdio.h>
int main()
{
    int n = 0;
    char c = 0;
    scanf("%d %c", &n, &c);
    if (n <= 1000 && c == 'n')
        printf("8\n");
    else if (n <= 1000 && c == 'y')
        printf("13\n");
    else if (n > 1000 && c == 'n')
    {
        if (n - 1000 <= 500)
            printf("12\n");
        else
            printf("%d\n", 8 + ((n - 1000) / 500 + 1) * 4);
    }
    else if (n > 1000 && c == 'y')
    {
        if (n - 1000 <= 500)
            printf("17\n");
        else
            printf("%d\n", 13 + ((n - 1000) / 500 + 1) * 4);
    }
    return 0;
}